<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>数组排序</title>
	</head>
	<body>
		<p>
			10、将数组[1,2,7,4,9,6,8,3,10,5]进行排序，
			<br />升序结果为：[1,2,3,4,5,6,7,8,9,10]，
			<br />倒序结果：[10,9,8,7,6,5,4,3,2,1]
		</p>
	</body>
	<script>
		let arr1 = [1,2,7,4,9,6,8,3,10,5];
			arr1=arr1.sort(function(n1,n2){
			if(n1<n2){return-1;}			
			});
			console.log("升序结果",arr1);
			
		let arr2 = [1,2,7,4,9,6,8,3,10,5];
			arr2=arr2.sort(function(n1,n2){
			if(n1>n2){return-1;}			
			});
			console.log("升序结果",arr2);
	</script>
</html>
